<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>密码框，点击切换加密和不加密的效果</title>
</head>
<body>
  <input type="password" id="pass" value="123456" />
  <input type="button" id="btn" value="点击显示" />
  <input type="button" id="arr" value="点击隐藏" >
  <script>
    var pass = document.getElementById('pass')
    var btn = document.getElementById('btn')
    var arr = document.getElementById('arr')
    btn.onclick = function () {
      pass.type = 'text'
    }
    arr.onclick = function () {
      pass.type = 'password'
    }
  </script>
</body>
</html>